// cDibSection.h: interface for the cDibSection class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CDIBSECTION_H__D89740BF_6254_489A_BFF6_15F71E03AD23__INCLUDED_)
#define AFX_CDIBSECTION_H__D89740BF_6254_489A_BFF6_15F71E03AD23__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class cDibSection  
{
public:
	int SetColor(int Index,int clr);
	int SetColors(int Index,int Count,RGBQUAD* lp);
	int GetColor(int Index);
	int GetColors(int Index,int Count,RGBQUAD* lp);
	void Cls();
	void PaintPicture(HDC lhDC, int lDestLeft, int lDestTop, int lDestWidth, int lDestHeight, int lSrcLeft, int lSrcTop);
	void PaintPicture(HDC lhDC, int lDestLeft, int lDestTop, int lDestWidth, int lDestHeight);
	void PaintPicture(HDC lhDC, int lDestLeft, int lDestTop);
	void PaintPicture(HDC lhDC,int lDestLeft,int lDestTop,int lDestWidth,int lDestHeight,int lSrcLeft,int lSrcTop,DWORD eRop);
	int CreateIndexed(int w, int h, int cClrBits, int bFlipRowOrder,void* lpPal);
	int CreateFromHBitmap(HBITMAP hBmp,int cClrBits);
	int CreateFromHBitmap(HBITMAP hBmp);
	int SavePicture(LPCTSTR sFileName);
	int Create(int w,int h,int cClrBits);
	cDibSection(int w,int h,int cClrBits);
	int Height();
	int Width();
	int BytesPerScanLine;
	int Create(int w,int h,int cClrBits,int bFlipRowOrder,int bIsR5G6B5);
	//' Address of memory pointing to the DIBSection's bits:
	void* DIBSectionBitsPtr;
	cDibSection();
	cDibSection(int w,int h,int cClrBits,int bFlipRowOrder,int bIsR5G6B5);
	~cDibSection();
	//' Handle to the current DIBSection:
	HBITMAP hDib;
	//' Handle to the Device context holding the DIBSection:
	HDC hDC;
	void ClearUp();
private:
	int CreateDIB(HDC lHDC,int lWidth,int lHeight,HBITMAP &hDib,int,int,int,void* lpPal);
	PBITMAPINFO lpBI;
	//' Handle to the old bitmap in the DC, for clear up:
	HBITMAP hBmpOld;
};

#endif // !defined(AFX_CDIBSECTION_H__D89740BF_6254_489A_BFF6_15F71E03AD23__INCLUDED_)
